{include file="public/head"/} 
<style>
    .yzl{
        height:30px;
        line-height:30px;
        padding: 0 10px;
        font-size: 14px;
    }
    #click{
        width:100%;
        height:100%;
        background-color: rgba(0,0,0,0.5);
        position:fixed;
        left: 0;
        top: 0;
        z-index: 1000;
        display: none;
    
      }
</style>
<link rel="stylesheet" href="static/admin/css/xadmin.css">
  <body>
     <div id="click" onclick="aa()" ></div>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">后台管理</a>
        <a href="">小区公告管理</a>
        <a><cite>小区公告</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
      <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so"  method="get" action="#">
          

          <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
        </form>
      </div>
      <xblock>
          <button class="layui-btn" onclick="x_admin_show('添加','{:url('announceAdd')}',700,600)"><i class="layui-icon"></i>添加</button>
        <span class="x-right" style="line-height:40px">共有数据：{$number} 条</span>
      </xblock>
      <table class="layui-table">
        <thead>
          <tr>
            
            <th>标题</th>
            <th>图片</th>
            <th>添加时间</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>
          {foreach $announcelist as $lis}
          <tr style="height:55px">
            <td>{$lis.title}</td>
            <td><img src="{$lis.bannerurl}"  onclick='mag("{$lis.bannerurl}")' style="width:40px;height:40px"></td>
            <td>{$lis.ctime}</td>
            <td>
                 <a title="查看" class="layui-btn" onclick="x_admin_show('查看','{:url('announceCon')}?id={$lis.id}')" href="javascript:;" style="height:27px;line-height:27px;padding: 0 10px;font-size: 14px;">
                查看
                </a>
                <a title="编辑" class="layui-btn layui-btn-sm layui-btn-normal" onclick="x_admin_show('编辑','{:url('announceEdit')}?id={$lis.id}')" href="javascript:;" style="height:27px;line-height:27px;padding: 0 10px;font-size: 14px;">
                编辑
                  </a>
                <a title="删除" onclick="announceDel('{$lis.id}', '{$lis.id}')" href="javascript:;" id="{$lis.id}" class="layui-btn layui-btn-sm layui-btn-danger" style="height:27px;line-height:27px;padding: 0 10px;font-size: 14px;">
                      删除
               </a>  
            </td>
          </tr>
          {/foreach}
        </tbody>
      </table>
      <div class="page">
        <div>
            {$list->render()}
        </div>
      </div>

    </div>
    <script>
    let a = document.getElementById("click")
      function mag(url){
          // console.log(123)

          a.style = "display:inline-block;"
          let b = `<img src="`+url+`" style="margin-left:20%;text-align:center">`
          a.innerHTML=b
      }
      function aa() {
          a.style = "display:none;"
      }

       //删除
      function announceDel(id, doc){
        if(confirm('删除后无法恢复，确定要删除吗?')) 
        { 
          var url = "{:url('announceDel')}?id=" + id
          // console.log(url)
          $('#' + doc).attr('href', url)
        } 
          return false; 
      } 
    </script>
    <script>
      var _hmt = _hmt || []; (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();
    </script>
  </body>

</html>